import request from '@/utils/request'
import baseURL from '@/utils/baseURLConfig'
/**
 * 树形表格
 */
export function getTreeResource() {
  return request({
    baseURL: baseURL.BASE_API,
    url: '/api/resource/getList',
    method: 'get',
  })
}
/**
 * 添加
 * @param {*} data
 */
export function createResource(data) {
  return request({
    baseURL: baseURL.BASE_API,
    url: '/api/resource/add',
    method: 'post',
    data
  })
}
/**
 * 删除
 * @param {*} data
 */
export function deleteResource(data) {
  return request({
    baseURL: baseURL.BASE_API,
    url: '/api/resource/del',
    method: 'get',
    params: data
  })
}
/**
 * 修改---
 * @param {*} data
 */
export function updateResource(data) {
  return request({
    baseURL: baseURL.BASE_API,
    url: '/api/resource/mod',
    method: 'post',
    data
  })
}
/**
 * 树形菜单
 */
export function getTreeMenu(data) {
  return request({
    baseURL: baseURL.BASE_API,
    url: '/api/resource/getMenu',
    method: 'get',
  })
}
/**
 * 查询该菜单分配给了哪些角色
 */
export function getSubjectRoles(data) {
  return request({
    baseURL: baseURL.BASE_API,
    url: '/api/resource/getSubjectRoles',
    method: 'get',
    params: data
  })
}
